#ifndef SSLCLIENTTHREAD_H
#define SSLCLIENTTHREAD_H


#include <QListWidget>
#include <QTimer>
#include <QNetworkConfigurationManager>
#include <QHostAddress>
#include <QSslSocket>
#include <QSslCipher>
#include <QSslConfiguration>
#include <QSslKey>
#include <QThread>
#include <QDebug>
class SSLClientThread : public QThread
{
    Q_OBJECT

public:
    SSLClientThread(QObject *parent = 0);
    ~SSLClientThread();
protected:
    void run();
    void PrintMsg(const char* msg){
        qDebug()<<msg;
    }

public slots:
    void connectToServer();
    void discontToServer();
    void handleSocketConnected();
    void handleSocketDisconnected();
    void dataReceived();
    void sendData();

    void handleSockStateChange(const QAbstractSocket::SocketState &socketState);
    void handleSocketError(const QAbstractSocket::SocketError &socketError);
    void handleSocketEncrypted();
    void handleSslModeChanged(QSslSocket::SslMode mode);
    void handleSslErrorList(const QList<QSslError> &errorList);
    void handlePeerVerifyError(const QSslError &error);
    void handleSslError(const QSslError &error);
private:

private slots:
    void _run();
private:
    bool hostConnected;
    int port;
    QHostAddress *serverIP;
    QSslSocket *socket;
    QTimer *runTimer;
};

#endif // SSLCLIENTTHREAD_H
